package com.example.demo1.Service;

import com.example.demo1.Bean.UserBean;
import com.example.demo1.Bean.UserStates;
import com.example.demo1.Mapper.UserStatusMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Service
public class UserstatusServiceImpl implements UserstatusService{
    @Resource
    UserStatusMapper userstatusMapper;

    @Override
    public PageInfo<UserStates> getAllUserStatus(int pageNum, int pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<UserStates> allOrderPresentList = userstatusMapper.getAllUserStatus();
        PageInfo<UserStates> pageInfo = new PageInfo<>(allOrderPresentList);
        return pageInfo;
    }

    @Override
    public PageInfo<UserStates> getAllUserStatusBykw(int pageNum, int pageSize,String keyword){
        PageHelper.startPage(pageNum, pageSize);
        List<UserStates> allOrderPresentList = userstatusMapper.selectUserStatusBykw(keyword);
        PageInfo<UserStates> pageInfo = new PageInfo<>(allOrderPresentList);
        return pageInfo;
    }

    @Override
    public List<UserStates> getAllUserStates(){
        return userstatusMapper.getAllUserStatus();
    }

    @Override
    public List<UserStates>  SearchUserStatusByid(String id){
        return userstatusMapper.SearchUserStatusById(id);
    }

    @Override
    public void updateUserStatus(String username, String UserId, String status, LocalDate date, String tem){
        userstatusMapper.updateUserStatus(username,UserId,status,date,tem);
    }



}
